using tables to define functions